home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 27 / CU Amiga Magazine's Super CD-ROM 27 (1998)(EMAP Images)(GB)[!][issue 1998-10].iso / CUCD / Programming / BlitzC2P / DemoA030.ascii < prev    next >
Encoding:
Text File  |  1998-08-01  |  13.0 KB  |  744 lines

  1. WBStartup
  2. NoCli
  3.  
  4. #c2pBPLX=320 ; chunky operation width
  5. #c2pBPLY=240 ; chunky operation height
  6. #planeheight=240 ; planar display height, must not be smaller than c2pBPLY
  7. #c2pBPLSIZE=(#c2pBPLX*#planeheight)/8
  8.  
  9. #scrwidth=#c2pBPLX
  10. #scrheight=#c2pBPLY
  11. #screensize=#scrwidth*#scrheight
  12.  
  13. ; DoublePAL 320x200 results on 040/25 25fps including clearscreening c2p (which runs @45.5fps)
  14. ; unmasked ~6000 4x1
  15. ; masked ~5000 4x1
  16. ; unmasked 3300 4x4
  17. ; masked 2600 4x4
  18. ; unmasked 1600 8x8
  19. ; masked 1180 8x8
  20. ; unmasked 600 16x16
  21. ; masked 400 16x16
  22. ; unmasked 200 32x32
  23. ; masked 115 32x32
  24. ; unmasked 45 64x64
  25. ; masked 28 64x64
  26. ; unmasked 11 128x128
  27. ; masked 6.5 128x128
  28.  
  29. ; PAL 320x200 as above
  30. ; unmasked 1660 8x8
  31. ; masked 1200 8x8
  32. ; ummasked 620 16x16
  33. ; masked 415 16x16
  34. ; unmasked 210 32x32
  35. ; masked 116 32x32
  36. ; ummasked 47 64x64
  37. ; masked 28 64x64
  38.  
  39. ; PAL 320x240 as above
  40. ; unmasked 2400 4x4
  41. ; masked 1950 4x4
  42. ; unmasked 1250 8x8
  43. ; masked 900 8x8
  44. ; unmasked 470 16x16
  45. ; masked 300 16x16
  46. ; unmasked 150 32x32
  47. ; masked 85 32x32
  48. ; unmasked 35 64x64
  49. ; masked 20 64x64
  50. ; unmasked 9 128x128
  51. ; masked 5 128x128
  52.  
  53. ; Default is 320x240 with 900 8x8 masked shapes.
  54. ; Can be raised to 1000 8x8 masked shapes with hardcoded xloop
  55. ; Or raised further to nearly 1100 8x8 masked shapes with hardcoded xloop and yloop
  56.  
  57. #iterations=800
  58.  
  59. #objcount=85 ; number of objects (0=none)
  60. #objmasking=1 ; Nonzero=masking
  61.  
  62. #objwidth=32 ; minimum of 8
  63. #objheight=32 ; minimum of 1
  64. #objlongwidth=#objwidth/4
  65.  
  66. #clearscreento=$00000000
  67.  
  68. ; c2p1x1_8_c5
  69. ;
  70. ; 132% on 040-25
  71.  
  72. Statement c2p030onlyinit{A.l,B.l}
  73.  
  74.   ;A.l=d0=Width.w
  75.   ;B.l=d1=Height.w
  76.  
  77. ; d0.w  chunkyx [chunky-pixels]
  78. ; d1.w  chunkyy [chunky-pixels]
  79. ; d2.w  (scroffsx) [screen-pixels]
  80. ; d3.w  scroffsy [screen-pixels]
  81. ; d4.w  (rowlen) [bytes] -- offset between one row and the next in a bpl
  82. ; d5.l  (c2pBPLSIZE) [bytes] -- offset between one row in one bpl and the next bpl
  83.  
  84.   MOVEQ.l #0,d2
  85.   MOVEQ.l #0,d3
  86.   MOVE.l  #c2pBPLX/8,d4
  87.   MOVE.l  d4,d5
  88.   MULU    d1,d5
  89.  
  90.   LEA c2p_datanew(pc),a0
  91.   ANDI.l  #$ffff,d0
  92.   MULU.w  d0,d3
  93.   LSR.l #3,d3
  94.   MOVE.l  d3,c2p_scroffs-c2p_data(a0)
  95.   MULU.w  d0,d1
  96.   MOVE.l  d1,c2p_pixels-c2p_data(a0)
  97. AsmExit
  98. End Statement
  99.  
  100. Statement c2p030only{A.l,B.l}
  101.  
  102.   MOVE.l  d0,a0 ; Chunky
  103.   MOVE.l  d1,a1 ; Planar
  104.  
  105. ; a0  c2pscreen
  106. ; a1  bitplanes
  107.  
  108. c2p1x1_8_c5
  109.   MOVEM.l a2-a6,-(a7)
  110.  
  111.   MOVEM.l a0-a1,-(a7)
  112.   LEA c2p_datanew,a0
  113.   LEA c2p_data,a1
  114.   MOVEQ #16-1,d0
  115. _copy: MOVE.l  (a0)+,(a1)+
  116.   DBF d0,_copy
  117.   MOVEM.l (a7)+,a0-a1
  118.   LEA c2p_data(pc),a2
  119.  
  120.   MOVE.l  #$33333333,d5
  121.   MOVE.l  #$55555555,d6
  122.   MOVE.l  #$00ff00ff,a6
  123.  
  124.   ADD.w #c2pBPLSIZE,a1
  125.   ADD.l c2p_scroffs-c2p_data(a2),a1
  126.  
  127.   MOVE.l  c2p_pixels-c2p_data(a2),a2
  128.   ADD.l a0,a2
  129.   CMP.l a0,a2
  130.   BEQ _none
  131.  
  132.   MOVEM.l a0-a1,-(a7)
  133.  
  134.   MOVE.l  (a0),d0
  135.   MOVE.l  #clearscreento,(a0)+
  136.   MOVE.l  (a0),d2
  137.   MOVE.l  #clearscreento,(a0)+
  138.   MOVE.l  (a0),d1
  139.   MOVE.l  #clearscreento,(a0)+
  140.   MOVE.l  (a0),d3
  141.   MOVE.l  #clearscreento,(a0)+
  142.  
  143.   MOVE.l  #$0f0f0f0f,d4   ; Merge 4x1, part 1
  144.   AND.l d4,d0
  145.   AND.l d4,d2
  146.   LSL.l #4,d0
  147.   OR.l  d2,d0
  148.  
  149.   AND.l d4,d1
  150.   AND.l d4,d3
  151.   LSL.l #4,d1
  152.   OR.l  d3,d1
  153.  
  154.   MOVE.l  d1,a3
  155.  
  156.   MOVE.l  (a0),d2
  157.   MOVE.l  #clearscreento,(a0)+
  158.   MOVE.l  (a0),d1
  159.   MOVE.l  #clearscreento,(a0)+
  160.   MOVE.l  (a0),d3
  161.   MOVE.l  #clearscreento,(a0)+
  162.   MOVE.l  (a0),d7
  163.   MOVE.l  #clearscreento,(a0)+
  164.  
  165.   AND.l d4,d2     ; Merge 4x1, part 2
  166.   AND.l d4,d1
  167.   LSL.l #4,d2
  168.   OR.l  d1,d2
  169.  
  170.   AND.l d4,d3
  171.   AND.l d4,d7
  172.   LSL.l #4,d3
  173.   OR.l  d7,d3
  174.  
  175.   MOVE.l  a3,d1
  176.  
  177.   MOVE.w  d2,d7     ; Swap 16x2
  178.   MOVE.w  d0,d2
  179.   SWAP  d2
  180.   MOVE.w  d2,d0
  181.   MOVE.w  d7,d2
  182.  
  183.   MOVE.w  d3,d7
  184.   MOVE.w  d1,d3
  185.   SWAP  d3
  186.   MOVE.w  d3,d1
  187.   MOVE.w  d7,d3
  188.  
  189.   BRA _start1
  190. _x1
  191.   MOVE.l  (a0),d0
  192.   MOVE.l  #clearscreento,(a0)+
  193.   MOVE.l  (a0),d2
  194.   MOVE.l  #clearscreento,(a0)+
  195.   MOVE.l  (a0),d1
  196.   MOVE.l  #clearscreento,(a0)+
  197.   MOVE.l  (a0),d3
  198.   MOVE.l  #clearscreento,(a0)+
  199.  
  200.   MOVE.l  d7,c2pBPLSIZE(a1)
  201.  
  202.   MOVE.l  #$0f0f0f0f,d4   ; Merge 4x1, part 1
  203.   AND.l d4,d0
  204.   AND.l d4,d2
  205.   LSL.l #4,d0
  206.   OR.l  d2,d0
  207.  
  208.   AND.l d4,d1
  209.   AND.l d4,d3
  210.   LSL.l #4,d1
  211.   OR.l  d3,d1
  212.  
  213.   MOVE.l  d1,a3
  214.  
  215.   MOVE.l  (a0),d2
  216.   MOVE.l  #clearscreento,(a0)+
  217.   MOVE.l  (a0),d1
  218.   MOVE.l  #clearscreento,(a0)+
  219.   MOVE.l  (a0),d3
  220.   MOVE.l  #clearscreento,(a0)+
  221.   MOVE.l  (a0),d7
  222.   MOVE.l  #clearscreento,(a0)+
  223.  
  224.   MOVE.l  a4,(a1)+
  225.  
  226.   AND.l d4,d2     ; Merge 4x1, part 2
  227.   AND.l d4,d1
  228.   LSL.l #4,d2
  229.   OR.l  d1,d2
  230.  
  231.   AND.l d4,d3
  232.   AND.l d4,d7
  233.   LSL.l #4,d3
  234.   OR.l  d7,d3
  235.  
  236.   MOVE.l  a3,d1
  237.  
  238.   MOVE.w  d2,d7     ; Swap 16x2
  239.   MOVE.w  d0,d2
  240.   SWAP  d2
  241.   MOVE.w  d2,d0
  242.   MOVE.w  d7,d2
  243.  
  244.   MOVE.w  d3,d7
  245.   MOVE.w  d1,d3
  246.   SWAP  d3
  247.   MOVE.w  d3,d1
  248.   MOVE.w  d7,d3
  249.  
  250.   MOVE.l  a5,-c2pBPLSIZE-4(a1)
  251. _start1
  252.   MOVE.l  a6,d4
  253.  
  254.   MOVE.l  d2,d7     ; Swap 2x2
  255.   LSR.l #2,d7
  256.   EOR.l d0,d7
  257.   AND.l d5,d7
  258.   EOR.l d7,d0
  259.   LSL.l #2,d7
  260.   EOR.l d7,d2
  261.  
  262.   MOVE.l  d3,d7
  263.   LSR.l #2,d7
  264.   EOR.l d1,d7
  265.   AND.l d5,d7
  266.   EOR.l d7,d1
  267.   LSL.l #2,d7
  268.   EOR.l d7,d3
  269.  
  270.   MOVE.l  d1,d7
  271.   LSR.l #8,d7
  272.   EOR.l d0,d7
  273.   AND.l d4,d7
  274.   EOR.l d7,d0
  275.   LSL.l #8,d7
  276.   EOR.l d7,d1
  277.  
  278.   MOVE.l  d1,d7
  279.   LSR.l #1,d7
  280.   EOR.l d0,d7
  281.   AND.l d6,d7
  282.   EOR.l d7,d0
  283.   MOVE.l  d0,c2pBPLSIZE*2(a1)
  284.   ADD.l d7,d7
  285.   EOR.l d1,d7
  286.  
  287.   MOVE.l  d3,d1
  288.   LSR.l #8,d1
  289.   EOR.l d2,d1
  290.   AND.l d4,d1
  291.   EOR.l d1,d2
  292.   LSL.l #8,d1
  293.   EOR.l d1,d3
  294.  
  295.   MOVE.l  d3,d1
  296.   LSR.l #1,d1
  297.   EOR.l d2,d1
  298.   AND.l d6,d1
  299.   EOR.l d1,d2
  300.   ADD.l d1,d1
  301.   EOR.l d1,d3
  302.  
  303.   MOVE.l  d2,a4
  304.   MOVE.l  d3,a5
  305.  
  306.   CMPA.l  a0,a2
  307.   BNE _x1
  308.  
  309.   MOVE.l  d7,c2pBPLSIZE(a1)
  310.   MOVE.l  a4,(a1)+
  311.   MOVE.l  a5,-c2pBPLSIZE-4(a1)
  312.  
  313.   MOVEM.l (a7)+,a0-a1
  314.   ADD.l #c2pBPLSIZE*4,a1
  315.  
  316.   MOVE.l  (a0),d0
  317.   MOVE.l  #clearscreento,(a0)+
  318.   MOVE.l  (a0),d2
  319.   MOVE.l  #clearscreento,(a0)+
  320.   MOVE.l  (a0),d1
  321.   MOVE.l  #clearscreento,(a0)+
  322.   MOVE.l  (a0),d3
  323.   MOVE.l  #clearscreento,(a0)+
  324.  
  325.   MOVE.l  #$f0f0f0f0,d4   ; Merge 4x1, part 1
  326.   AND.l d4,d0
  327.   AND.l d4,d2
  328.   LSR.l #4,d2
  329.   OR.l  d2,d0
  330.  
  331.   AND.l d4,d1
  332.   AND.l d4,d3
  333.   LSR.l #4,d3
  334.   OR.l  d3,d1
  335.  
  336.   MOVE.l  d1,a3
  337.  
  338.   MOVE.l  (a0),d2
  339.   MOVE.l  #clearscreento,(a0)+
  340.   MOVE.l  (a0),d1
  341.   MOVE.l  #clearscreento,(a0)+
  342.   MOVE.l  (a0),d3
  343.   MOVE.l  #clearscreento,(a0)+
  344.   MOVE.l  (a0),d7
  345.   MOVE.l  #clearscreento,(a0)+
  346.  
  347.   AND.l d4,d2     ; Merge 4x1, part 2
  348.   AND.l d4,d1
  349.   LSR.l #4,d1
  350.   OR.l  d1,d2
  351.  
  352.   AND.l d4,d3
  353.   AND.l d4,d7
  354.   LSR.l #4,d7
  355.   OR.l  d7,d3
  356.  
  357.   MOVE.l  a3,d1
  358.  
  359.   MOVE.w  d2,d7     ; Swap 16x2
  360.   MOVE.w  d0,d2
  361.   SWAP  d2
  362.   MOVE.w  d2,d0
  363.   MOVE.w  d7,d2
  364.  
  365.   MOVE.w  d3,d7
  366.   MOVE.w  d1,d3
  367.   SWAP  d3
  368.   MOVE.w  d3,d1
  369.   MOVE.w  d7,d3
  370.  
  371.   BRA _start2
  372. _x2
  373.   MOVE.l  (a0),d0
  374.   MOVE.l  #clearscreento,(a0)+
  375.   MOVE.l  (a0),d2
  376.   MOVE.l  #clearscreento,(a0)+
  377.   MOVE.l  (a0),d1
  378.   MOVE.l  #clearscreento,(a0)+
  379.   MOVE.l  (a0),d3
  380.   MOVE.l  #clearscreento,(a0)+
  381.  
  382.   MOVE.l  d7,c2pBPLSIZE(a1)
  383.  
  384.   MOVE.l  #$f0f0f0f0,d4   ; Merge 4x1, part 1
  385.   AND.l d4,d0
  386.   AND.l d4,d2
  387.   LSR.l #4,d2
  388.   OR.l  d2,d0
  389.  
  390.   AND.l d4,d1
  391.   AND.l d4,d3
  392.   LSR.l #4,d3
  393.   OR.l  d3,d1
  394.  
  395.   MOVE.l  d1,a3
  396.  
  397.   MOVE.l  (a0),d2
  398.   MOVE.l  #clearscreento,(a0)+
  399.   MOVE.l  (a0),d1
  400.   MOVE.l  #clearscreento,(a0)+
  401.   MOVE.l  (a0),d3
  402.   MOVE.l  #clearscreento,(a0)+
  403.   MOVE.l  (a0),d7
  404.   MOVE.l  #clearscreento,(a0)+
  405.  
  406.   MOVE.l  a4,(a1)+
  407.  
  408.   AND.l d4,d2     ; Merge 4x1, part 2
  409.   AND.l d4,d1
  410.   LSR.l #4,d1
  411.   OR.l  d1,d2
  412.  
  413.   AND.l d4,d3
  414.   AND.l d4,d7
  415.   LSR.l #4,d7
  416.   OR.l  d7,d3
  417.  
  418.   MOVE.l  a3,d1
  419.  
  420.   MOVE.w  d2,d7     ; Swap 16x2
  421.   MOVE.w  d0,d2
  422.   SWAP  d2
  423.   MOVE.w  d2,d0
  424.   MOVE.w  d7,d2
  425.  
  426.   MOVE.w  d3,d7
  427.   MOVE.w  d1,d3
  428.   SWAP  d3
  429.   MOVE.w  d3,d1
  430.   MOVE.w  d7,d3
  431.  
  432.   MOVE.l  a5,-c2pBPLSIZE-4(a1)
  433. _start2
  434.   MOVE.l  a6,d4
  435.  
  436.   MOVE.l  d2,d7     ; Swap 2x2
  437.   LSR.l #2,d7
  438.   EOR.l d0,d7
  439.   AND.l d5,d7
  440.   EOR.l d7,d0
  441.   LSL.l #2,d7
  442.   EOR.l d7,d2
  443.  
  444.   MOVE.l  d3,d7
  445.   LSR.l #2,d7
  446.   EOR.l d1,d7
  447.   AND.l d5,d7
  448.   EOR.l d7,d1
  449.   LSL.l #2,d7
  450.   EOR.l d7,d3
  451.  
  452.   MOVE.l  d1,d7
  453.   LSR.l #8,d7
  454.   EOR.l d0,d7
  455.   AND.l d4,d7
  456.   EOR.l d7,d0
  457.   LSL.l #8,d7
  458.   EOR.l d7,d1
  459.  
  460.   MOVE.l  d1,d7
  461.   LSR.l #1,d7
  462.   EOR.l d0,d7
  463.   AND.l d6,d7
  464.   EOR.l d7,d0
  465.   MOVE.l  d0,c2pBPLSIZE*2(a1)
  466.   ADD.l d7,d7
  467.   EOR.l d1,d7
  468.  
  469.   MOVE.l  d3,d1
  470.   LSR.l #8,d1
  471.   EOR.l d2,d1
  472.   AND.l d4,d1
  473.   EOR.l d1,d2
  474.   LSL.l #8,d1
  475.   EOR.l d1,d3
  476.  
  477.   MOVE.l  d3,d1
  478.   LSR.l #1,d1
  479.   EOR.l d2,d1
  480.   AND.l d6,d1
  481.   EOR.l d1,d2
  482.   ADD.l d1,d1
  483.   EOR.l d1,d3
  484.  
  485.   MOVE.l  d2,a4
  486.   MOVE.l  d3,a5
  487.  
  488.   CMPA.l  a0,a2
  489.   BNE _x2
  490.  
  491.   MOVE.l  d7,c2pBPLSIZE(a1)
  492.   MOVE.l  a4,(a1)+
  493.   MOVE.l  a5,-c2pBPLSIZE-4(a1)
  494.  
  495. _none
  496.   MOVEM.l (a7)+,a2-a6
  497. AsmExit
  498.  
  499.   Even4
  500. c2p_data
  501. c2p_scroffs: Dc.l 0
  502. c2p_pixels: Dc.l 0
  503.   Ds.l  16
  504.   Even4
  505. c2p_datanew
  506.   Ds.l  16
  507. End Statement
  508.  
  509. Statement chunkyshape1{A.l,B.l,C.l,D.l}
  510. .chunkyshape1
  511. ;any position masked with mask data and movement table
  512.   MOVEM.l a3-a6,-(a7)
  513.   MOVE.l  #objcount-1,d7 ; object loop
  514.   MOVE.l  d3,a3 ; base of table
  515.   MOVE.l  d0,a4 ; store
  516.   MOVE.l  d1,a5 ; store
  517.   MOVE.l  d2,a6 ; store
  518. objloop
  519.  
  520.   MOVEQ.l #0,d3
  521.   MOVE.w  (a3),d3
  522.   MOVEQ.l #0,d5
  523.   MOVEQ.l #0,d6
  524.   MOVE.w  4(a3),d5
  525.   MOVE.w  6(a3),d6
  526.   CMP.w   #6,d3 ; x<6?
  527.   BLE     xle
  528.   CMP.w   #scrwidth-objwidth-6,d3
  529.   BLT     xskip
  530. xle
  531.   EXG.l   d5,d6
  532. xskip
  533.   EXT.l   d5
  534.   ADD.l   d5,d3
  535.   MOVE.w  d3,(a3)
  536.   MOVE.w  d5,4(a3)
  537.   MOVE.w  d6,6(a3)
  538.  
  539.   MOVEQ.l #0,d4
  540.   MOVE.w  2(a3),d4
  541.   MOVEQ.l #0,d5
  542.   MOVEQ.l #0,d6
  543.   MOVE.w  8(a3),d5
  544.   MOVE.w  10(a3),d6
  545.   CMP.w   #6,d4 ; y<6?
  546.   BLE     yle
  547.   CMP.w   #scrheight-objheight-6,d4
  548.   BLT     yskip
  549. yle
  550.   EXG.l   d5,d6
  551. yskip
  552.   EXT.l   d5
  553.   ADD.l   d5,d4
  554.   MOVE.w  d4,2(a3)
  555.   MOVE.w  d5,8(a3)
  556.   MOVE.w  d6,10(a3)
  557.  
  558.   ADD.l   #12,a3
  559.   MULU    #scrwidth,d4
  560.   MOVE.l  a4,a0 ; input
  561.   ADD.l   d3,d4
  562.   MOVE.l  a5,a2 ; mask
  563.   MOVE.l  a6,d2
  564.   ADD.l   d4,d2 ; output
  565.   MOVE.l  d2,a1 ; output
  566.   MOVE.l  #objheight-1,d2
  567.   MOVE.l  #scrwidth-objwidth,d3
  568. ;Do masked blit
  569. yloop
  570.     MOVEQ.l #objlongwidth-1,d4
  571. xloop
  572.       MOVE.l  (a2)+,d0
  573.       AND.l   d0,(a1)
  574.       MOVE.l  (a0)+,d1
  575.       OR.l    d1,(a1)+
  576.       DBRA    d4,xloop
  577.     ADD.l   d3,a1
  578.     DBRA    d2,yloop
  579.   DBRA    d7,objloop
  580.   MOVEM.l (a7)+,a3-a6
  581. AsmExit
  582. End Statement
  583.  
  584. Statement chunkyshape2{A.l,B.l,C.l,D.l}
  585. .chunkyshape2
  586. ;any position masked with mask data and movement table
  587. ;B.l is unused in this routine
  588.   MOVEM.l a3-a6,-(a7)
  589.   MOVE.l  #objcount-1,d7 ; object loop
  590.   MOVE.l  d3,a3 ; base of table
  591.   MOVE.l  d0,a4 ; store
  592. ;  MOVE.l  d1,a5 ; store
  593.   MOVE.l  d2,a6 ; store
  594. objloop2
  595.  
  596.   MOVEQ.l #0,d3
  597.   MOVE.w  (a3),d3
  598.   MOVEQ.l #0,d5
  599.   MOVEQ.l #0,d6
  600.   MOVE.w  4(a3),d5
  601.   MOVE.w  6(a3),d6
  602.   CMP.w   #6,d3 ; x<6?
  603.   BLE     xle2
  604.   CMP.w   #scrwidth-objwidth-6,d3
  605.   BLT     xskip2
  606. xle2
  607.   EXG.l   d5,d6
  608. xskip2
  609.   EXT.l   d5
  610.   ADD.l   d5,d3
  611.   MOVE.w  d3,(a3)
  612.   MOVE.w  d5,4(a3)
  613.   MOVE.w  d6,6(a3)
  614.  
  615.   MOVEQ.l #0,d4
  616.   MOVE.w  2(a3),d4
  617.   MOVEQ.l #0,d5
  618.   MOVEQ.l #0,d6
  619.   MOVE.w  8(a3),d5
  620.   MOVE.w  10(a3),d6
  621.   CMP.w   #6,d4 ; y<6?
  622.   BLE     yle2
  623.   CMP.w   #scrheight-objheight-6,d4
  624.   BLT     yskip2
  625. yle2
  626.   EXG.l   d5,d6
  627. yskip2
  628.   EXT.l   d5
  629.   ADD.l   d5,d4
  630.   MOVE.w  d4,2(a3)
  631.   MOVE.w  d5,8(a3)
  632.   MOVE.w  d6,10(a3)
  633.  
  634.   ADD.l   #12,a3
  635.   MULU    #scrwidth,d4
  636.   MOVE.l  a4,a0 ; input
  637.   ADD.l   d3,d4
  638. ;  MOVE.l  a5,a2 ; mask
  639.   MOVE.l  a6,d2
  640.   ADD.l   d4,d2 ; output
  641.   MOVE.l  d2,a1 ; output
  642.   MOVE.l  #objheight-1,d2
  643.   MOVE.l  #scrwidth-objwidth,d3
  644. ;Do unmasked blit
  645. yloop2
  646.     MOVEQ.l #objlongwidth-1,d4
  647. xloop2
  648.       MOVE.l  (a0)+,(a1)+
  649.       DBRA    d4,xloop2
  650.     ADD.l   d3,a1
  651.     DBRA    d2,yloop2
  652.   DBRA    d7,objloop2
  653.   MOVEM.l (a7)+,a3-a6
  654. AsmExit
  655. End Statement
  656.  
  657. .blitzprogram
  658. ; Setup
  659. InitBank 1,#scrwidth*#scrheight,$10000 ; Fastram chunky buffer
  660. InitPalette 0,256
  661. For c=1 To 255
  662.   AGAPalRGB 0,c,(c/2)+Rnd(128),(c/2)+Rnd(128),(c/2)+Rnd(128)
  663. Next c
  664. AGAPalRGB 0,0,0,0,0
  665. VWait
  666. InitBank 0,(#scrwidth*Max(#planeheight,#c2pBPLY))+1000,2|65536 ; Chipram planar buffer
  667. CludgeBitMap 0,#scrwidth,Max(#planeheight,#c2pBPLY),8,Bank(0)
  668. Screen 0,0,0,#scrwidth,Max(#planeheight,#c2pBPLY),8,0,"c2p test",0,0,0
  669. Use Palette 0
  670. VWait 50
  671.  
  672. ; chunky shape
  673. InitBank 2,#objwidth*#objheight,$10000 ; chunky shape
  674. cstep.q=256/(#objwidth*#objheight)
  675. c.q=0
  676. For o.l=0 To (#objwidth*#objheight)-1
  677.   NPokeB Bank(2)+o,255-c
  678.   c+cstep
  679. Next o
  680. If #objmasking<>0
  681.   CacheClearU_
  682.   For o.l=0 To #objwidth*#objheight
  683.     p3.l=Bank(2)+Rnd(#objwidth*#objheight)-1
  684.     NPokeB p3,$00
  685.   Next o
  686. EndIf
  687.  
  688. ; chunky mask
  689. InitBank 3,#objwidth*#objheight,$10000 ; chunky mask
  690. For o.l=0 To (#objwidth*#objheight)-1
  691.   If NPeekB(Bank(2)+o)=0 Then NPokeB Bank(3)+o,$ff Else NPokeB Bank(3)+o,$0
  692. Next o
  693.  
  694. ; movement table
  695. InitBank 5,#objcount*12,$10000 ; table
  696. For o.l=0 To (#objcount-1)*12 Step 12
  697.   p1.w=6+Rnd(#scrwidth-#objwidth-14)
  698.   p2.w=6+Rnd(#scrheight-#objheight-14)
  699.   NPokeW Bank(5)+o,p1
  700.   NPokeW Bank(5)+o+2,p2
  701.   Repeat:xmove.w=Rnd(2)-Rnd(4):Until xmove<>0
  702.   Repeat:ymove.w=Rnd(2)-Rnd(4):Until ymove<>0
  703.   NPokeW Bank(5)+o+4,xmove
  704.   NPokeW Bank(5)+o+6,-xmove
  705.   NPokeW Bank(5)+o+8,ymove
  706.   NPokeW Bank(5)+o+10,-ymove
  707. Next o
  708.  
  709. ; Do the c2p test
  710. c2p030onlyinit{#scrwidth,#scrheight}
  711. CacheClearU_
  712. Forbid_
  713. VWait
  714. If #objmasking<>0
  715.   ResetTimer
  716.   For time=1 To #iterations
  717.     chunkyshape1{Bank(2),Bank(3),Bank(1),Bank(5)}
  718.     c2p030only{Bank(1),Bank(0)} ; Convert chunky to planar
  719.   Next time
  720.   t=Ticks
  721. Else
  722.   ResetTimer
  723.   For time=1 To #iterations
  724.     chunkyshape2{Bank(2),Bank(3),Bank(1),Bank(5)}
  725.     c2p030only{Bank(1),Bank(0)} ; Convert chunky to planar
  726.   Next time
  727.   t=Ticks
  728. EndIf
  729.  
  730. VWait 2 : Permit_
  731. VWait 20
  732. FindScreen 0
  733. Window 0,0,11,640,100,0,"Test results for c2p",0,0
  734. WindowOutput 0
  735. per.f=1/(t/#iterations)
  736. NPrint "Routine performed @ ",50/(t/#iterations),"fps - ",t," ticks - ",per," per frame"
  737. NPrint " "
  738. NPrint "Press mousebutton..."
  739. Free Screen 0
  740. MouseWait
  741. Free Window 0
  742. End
  743.  
  744.